# $Id$
# Maintainer: Eric Bélanger <eric@archlinux.org>

pkgname=timidity++
pkgver=2.14.0
pkgrel=7
pkgdesc="A MIDI to WAVE converter and player"
arch=('i686' 'x86_64')
url="http://timidity.sourceforge.net"
license=('GPL')
depends=('libao' 'jack')
makedepends=('xaw3d' 'gtk2' 'tk' 'libxaw')
optdepends=('gtk2: for using the GTK+ interface'
            'tk: for using the Tk interface'
            'xaw3d: for using the Xaw interface')
backup=('etc/timidity++/timidity.cfg')
source=(http://downloads.sourceforge.net/timidity/TiMidity++-${pkgver}.tar.xz
        timidity.cfg timidity.service timidity-tk86.patch timidity-jack.patch)
sha1sums=('15ec27f1ea3e718a8d61603521fc16df5c0dd24b'
          '660b3afbb720d26e8f008034cee66dd8da082d6e'
          'f0351b9eb8928d3d82c380107654a7dbe7cd2d54'
          '5c6022a79c20fbb31afc28b9713c903fccff93c8'
          'c0d58d1cb4bd0eb82a965531ffe83cc3f540e318')

prepare() {
  cd TiMidity++-${pkgver}
  patch -p1 -i "${srcdir}/timidity-tk86.patch"
  patch -p1 -i "${srcdir}/timidity-jack.patch"
}

build() {
  cd TiMidity++-${pkgver}
  ./configure --prefix=/usr --mandir=/usr/share/man --with-default-path=/etc/timidity++/ \
    --enable-server --enable-alsaseq --enable-spectrogram --enable-network --enable-xft \
    --enable-audio=alsa,oss,ao,vorbis,flac,jack \
    --enable-dynamic=ncurses,tcltk,vt100,xaw,gtk
  make
}

package() {
  cd TiMidity++-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -D -m644 ../timidity.cfg "${pkgdir}/etc/timidity++/timidity.cfg"
  install -D -m644 ../timidity.service "${pkgdir}/usr/lib/systemd/system/timidity.service"
}
